//
//  BuyerDetailHeaderReusableView.m
//  UGoods
//
//  Created by dllo on 16/1/22.
//  Copyright © 2016年 蓝鸥科技.李贺. All rights reserved.
//

#import "BuyerDetailHeaderReusableView.h"
#import "ConstantsDefine.h"
@interface BuyerDetailHeaderReusableView ()


@end

@implementation BuyerDetailHeaderReusableView

- (void)dealloc
{
    [_buyerImageView release];
    [_buyerNameLabel release];
    [_introLabel release];
    [_titleLabel release];
    [_guideTextView release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView *backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 110 * WIDTH, 100 * HEIGHT)];
        backImageView.center = CGPointMake(self.center.x, 150 * HEIGHT);
        [backImageView setImage:[UIImage imageNamed:@"iconfont-guanzhuliubianxing-5"]];
        [self addSubview:backImageView];
        [backImageView release];
        

        self.buyerImageView = [[UIImageView alloc] init];
        _buyerImageView.frame = CGRectMake(0, 0, 80 * WIDTH, 80 * HEIGHT);
        _buyerImageView.center = backImageView.center;
        // 切割图片为正六边行
        float viewWidth = 80 * WIDTH;
        UIBezierPath * path = [UIBezierPath bezierPath];
        path.lineWidth = 2 * WIDTH;
        [[UIColor whiteColor] setStroke];
        [path moveToPoint:CGPointMake((sin(M_1_PI / 180 * 60)) * (viewWidth / 2), (viewWidth / 4))];
        [path addLineToPoint:CGPointMake((viewWidth / 2), 0)];
        [path addLineToPoint:CGPointMake(viewWidth - ((sin(M_1_PI / 180 * 60)) * (viewWidth / 2)), (viewWidth / 4))];
        [path addLineToPoint:CGPointMake(viewWidth - ((sin(M_1_PI / 180 * 60)) * (viewWidth / 2)), (viewWidth / 2) + (viewWidth / 4))];
        [path addLineToPoint:CGPointMake((viewWidth / 2), viewWidth)];
        [path addLineToPoint:CGPointMake((sin(M_1_PI / 180 * 60)) * (viewWidth / 2), (viewWidth / 2) + (viewWidth / 4))];
        [path closePath];
        CAShapeLayer * shapLayer = [CAShapeLayer layer];
        shapLayer.lineWidth = 5 * WIDTH;
        shapLayer.strokeColor = [UIColor colorWithRed:1.000 green:0.596 blue:0.667 alpha:1.000].CGColor;
        shapLayer.path = path.CGPath;
        _buyerImageView.layer.mask = shapLayer;
        [self addSubview:_buyerImageView];
        [_buyerImageView release];
        
        self.buyerNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200 * WIDTH, 20 * HEIGHT)];
        _buyerNameLabel.center = CGPointMake(self.center.x, 220 * HEIGHT);
        _buyerNameLabel.textColor = [UIColor whiteColor];
        _buyerNameLabel.textAlignment = NSTextAlignmentCenter;
        _buyerNameLabel.font = [UIFont systemFontOfSize:13 * WIDTH];
        [self addSubview:_buyerNameLabel];
        [_buyerNameLabel release];
        
        self.introLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200 * WIDTH, 40 * HEIGHT)];
        _introLabel.center = CGPointMake(self.center.x, 260 * HEIGHT);
        _introLabel.textColor = [UIColor whiteColor];
        _introLabel.textAlignment = NSTextAlignmentCenter;
        _introLabel.numberOfLines = 0;
        _introLabel.font = [UIFont systemFontOfSize:13 * WIDTH];
        [self addSubview:_introLabel];
        [_introLabel release];
        
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40 * WIDTH, 2 * HEIGHT)];
        lineView.center = CGPointMake(self.center.x, 300 * HEIGHT);
        lineView.backgroundColor = [UIColor whiteColor];
        [self addSubview:lineView];
        [lineView release];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200 * WIDTH, 20 * HEIGHT)];
        _titleLabel.center = CGPointMake(self.center.x, 330 * HEIGHT);
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.numberOfLines = 0;
        _titleLabel.font = [UIFont systemFontOfSize:15 * WIDTH];
        [self addSubview:_titleLabel];
        [_titleLabel release];
        
        self.guideTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 250 * WIDTH, 170 * HEIGHT)];
        _guideTextView.center = CGPointMake(self.center.x, 440 * HEIGHT);
        _guideTextView.textColor = [UIColor whiteColor];
        _guideTextView.font = [UIFont systemFontOfSize:13 * WIDTH];
        _guideTextView.backgroundColor = [UIColor clearColor];
        _guideTextView.editable = NO;
        [self addSubview:_guideTextView];
        [_guideTextView release];
        
    }
    return self;
}


@end
